package com.study.ui.test.test_download

import org.json.JSONObject
import java.io.Serializable

/**
 * 作者：李炳军
 * 创建日期：2021-04-01  10:59
 * 释义：
 */
data class DownloadBean(
    val title: String,
    val content: String,
    val url: String,
    val md5: String,
    val versionCode: String
):Serializable {
    companion object {
        fun parse(json: String): DownloadBean {
            val jsonObject = JSONObject(json)
            val title = jsonObject.getString("title") ?: ""
            val content = jsonObject.getString("content") ?: ""
            val url = jsonObject.getString("url") ?: ""
            val md5 = jsonObject.getString("md5") ?: ""
            val versionCode = jsonObject.getString("versionCode") ?: ""
            return DownloadBean(title, content, url, md5, versionCode)
        }
    }
}